//
// Created by zhouwd on 2019/7/12.
//

#include "media_extractor.h"

int _MEDIA_EXTRACTOR::init(const char *filename) {
    mediaVideoDecode->init(filename);
    mediaAudioPlay->init(filename);
    return 0;
}

int _MEDIA_EXTRACTOR::startExtractor() {
    mediaAudioPlay->startAudioPlay();
    mediaVideoDecode->startDecode();
    return 0;
}

_MEDIA_EXTRACTOR::_MEDIA_EXTRACTOR() {
    mediaAudioPlay = new MediaAudioPlay();
    mediaVideoDecode = new MediaVideoDecode();

}

_MEDIA_EXTRACTOR::~_MEDIA_EXTRACTOR() {
    delete mediaAudioPlay;
    delete mediaVideoDecode;

}

int _MEDIA_EXTRACTOR::destroy() {

    AMediaExtractor_delete(videoExtractor);
    AMediaExtractor_delete(audioExtractor);

    return 0;
}

int _MEDIA_EXTRACTOR::getVideoWidth() {
    return mediaVideoDecode->getWidth();
}

int _MEDIA_EXTRACTOR::getVideoHeight() {
    return mediaVideoDecode->getHeight();
}

int _MEDIA_EXTRACTOR::initMediaRender(MediaVideoFrame *mediaVideoFrame) {
    return mediaVideoDecode->initMediaVideoFrame(mediaVideoFrame);
}



